class TFHGunSiegeM extends TFProjectileFire;

var bool bSiegeMode;
var float tnext;
//var tfhgunsfield sfield;

simulated function Timer()
{
    if(bsiegemode)
    {
        instigator.Velocity*=0.0;
        if(playercontroller(instigator.controller)!=none)
            playercontroller(instigator.controller).clientflash(0.8, vect(250,0,750));
    }
}

simulated function Tick(float dt)
{
    if(bsiegemode) instigator.controller.bduck=1;
}

function bool IsIdle()
{
	return false;
}

auto state Idle
{
    function bool IsIdle()
	{
		return true;
	}

    function BeginState()
    {
        settimer(0.075, true);
    }

    function EndState()
    {
        instigator.controller.bduck=0;
    }

    function StartFiring()
    {
        if(!bsiegemode) Weapon.PlayOwnedSound(Sound'TFMedia.Gunner.HGsiegeOn',SLOT_Interact,4);
        else Weapon.PlayOwnedSound(Sound'TFMedia.Gunner.HGsiegeOff',SLOT_Interact,4);
        GotoState('SiegeMode');
    }
}

state SiegeMode
{
    simulated function BeginState()
    {
        tnext=level.TimeSeconds+2.2;
    }

    /*simulated function timer()
    {
        gotostate('idle');
    }*/

    function ModeTick(float dt)
    {
        Super.ModeTick(dt);

        if(level.TimeSeconds>=tnext)
        {
            bsiegemode=!bsiegemode;
            gotostate('idle');
        }
    }

    function StopFiring()
    {
    }
}

/*simulated function Destroyed()
{
    if(sfield!=none) sfield.Destroy();

    super.Destroyed();
}*/

defaultproperties
{
     PreFireTime=2.500000
     FireRate=2.500000
     AmmoClass=Class'taskforces.TFHGunAmmo'
     BotRefireRate=0.300000
}
